/**
 * Created by pc on 2017/5/23.
 */

$(function () {
    var authList = $('#authList');
    authList.on('click', '.syscheckBox', function (ev) {
        var current = $(this);
        var li = current.closest('li');
        var childInput = li.find('ul .syscheckBox');
        childInput.prop('checked', current.prop('checked'));
        var parentInput = current.closest('ul').siblings('h4').find('.syscheckBox');
        if (parentInput.length) {
            var siblings = li.closest('ul').find('>li > h4 .syscheckBox');
            parentInput.prop('checked', siblings.length === siblings.filter(':checked').length);
        }
    });
});